This article examines the simulation, optimization and dynamic modeling of a multi-source energy production system. This system includes solar panels and CCHP devices as the main energy production equipment and the target functions also include: total electricity consumption, total gas consumption, CCHP fuel consumption as well as return on investment, as the economic and energy response of the system. Further analysis of the dynamic results of the system includes: temperature changes, efficiency and average daily electricity produced by solar panels, average daily absorbed energy in solar collectors, hourly changes in electricity demand, electricity produced by solar panels and electricity produced by CCHP, the hourly changes in electricity demand, the total electricity produced and the hourly changes in gas consumption demand of the system and the complex will be investigated throughout the year. The results show that the utility distribution in the optimization section is 0. 735. This number showes that the system is in a suitable and ideal state and the return on investment can be justified with 1. 64 years. Also, even though the amount of solar radiation is higher in the hot months of the year, but due to the increase in the temperature of the solar cell, the efficiency of the solar panel decreases. These systems are also able to use solar energy to provide part of the heating needs of the complex’s hot water system. The design and use of the combined optimal system of CCHP and solar panels allow the complex to fully and sustainably supply its electricity needs provide and even sell the excess amount of electricity to the public power grid and use it as a source of additional income.